package com.liandu.entity;

import com.liandu.common.parent.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.util.Date;

/**
 * 电子秤信息
 */
@Setter
@Getter
@ToString
@Entity
@Table(name = "ecrinfo")
public class EcrInfo extends BaseEntity {

    private static final long serialVersionUID = 7971596006000976820L;
    //秤ID
    @Id
    private String ecrID;
    //经营主体编码
//    private String busiId;
    //经营户的第几台秤
    private Integer ecrNo;
    //秤类别
    private String ecrType;
    //版本号
    private String version;
    //流水号
    private String serialNo;
    //秤ip
    private String Ip;
    //插入时间
//    private Date insertDateTime;
    //状态（1打开，2关闭）
    private Integer status;
    //状态开始时间
    private Date statusStartTime;
    //按零开关(0关闭，1打开)
    private Integer opentag;
    //识别类型（0不识别，1蔬菜，2肉类，3水产，4杂货，5干水产，6水果）
    private Integer classifyType;
    //摊位号
    private String busiNo;


/*    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "ecrID",referencedColumnName = "ecrID")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<CalInfo> calInfoList;*/

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "busiId",referencedColumnName = "busiInfoID")
//    @NotFound(action = NotFoundAction.IGNORE)
    private BusiInfo busiInfo;

/*    @OneToMany(fetch = FetchType.LAZY)
    @JoinColumn(name = "uploadDevice",referencedColumnName = "ecrID")
//    @NotFound(action = NotFoundAction.IGNORE)
    private List<WeighInfo> weighInfoList;*/
//remake：name主控方指向受控方的字段名，referencedColumnName受控方的字段名，所谓主控方就是能改变关联关系的一方

    @OneToOne
    @JoinColumn(name = "ecrID")
    private Mac mac;
 }
